import { MyVue } from 'src/wl/my_vue';
import Vue from 'vue';
import { Component, Emit, Prop, Provide, Watch } from 'vue-property-decorator'
import { MemberConst } from "src/consts/member_const";
@Component({})
export default class MemberPanel extends MyVue {
    name: string = 'MemberPanel';
    formData: any;
    footerFlag: boolean = true;
    beforeCreate(): void {
    }

    initData(that?: any): void {
        that.formData = WLStore().state.memberShow;
    }

    mounted(): void {
    }

    editAcc(): void {
        this.$refs.memberForm.validate((valid: Boolean) => {
            if (valid) {
                let sendData: any = this.formData
                var arr = ["ROLE_assist_start",
                    "ROLE_assist_operate_request",
                    "ROLE_assist_webhistory_add",
                    "ROLE_assist_webaccount_get",
                    "ROLE_assist_task_close",
                    "ROLE_assist_config_get",
                    "ROLE_assist_operate_result_get",
                    "ROLE_assist_camsgpin_get",
                    "ROLE_assist_website_get",
                    "ROLE_assist_cookie_get",
                    "ROLE_option_list"]

                for (let i = 0; i < this.formData.Authority.length; i++) {
                    arr.push(this.formData.Authority[i].id)
                }

                sendData.authority_list = arr
                delete sendData.authority_info_list
                delete sendData.feature_code
                delete sendData.create_time
                delete sendData.update_time

                WLDispatch(MemberConst.DispatchMemberEdit, sendData);
            } else {
                WLMessage("必填字段为空,无法编辑角色", "warning")
                return false;
            }
        })
    }

    authority(): void {
        WLCommit(MemberConst.CommitType, "edit")
        let senData: any = {}
        senData["id"] = this.formData.id
        WLDispatch(MemberConst.DispatchMemberSet, senData);
    }
}